export function setAnimationFrameInterval(callback: FrameRequestCallback) {
  let timer: number;

  const start = () => {
    timer = requestAnimationFrame((time: DOMHighResTimeStamp) => {
      callback(time);
      start();
    });
  };

  start();

  return () => {
    cancelAnimationFrame(timer);
  };
}